package com.zmm.myyimixian.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.zmm.myyimixian.bean.HomeBoosTitle;

import java.util.List;

/**
 * Created by wencai2015 on 2016/10/9.
 */
public class Find_tab_Adapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;
    private List<HomeBoosTitle> list;

    public Find_tab_Adapter(FragmentManager fm, List<Fragment> fragments, List<HomeBoosTitle> list) {
        super(fm);
        this.fragments = fragments;
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments!=null?fragments.get(position):null;
    }

    @Override
    public int getCount() {
        return fragments!=null?fragments.size():0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        // 显示在TabLayout 上的内容，我们只要name信息
        return list!=null?list.get(position).getName():null;
    }
}
